var ws = require("nodejs-websocket");

var conn = ws.connect("ws://localhost:8001");
conn.on("connect",function(code){
    conn.sendText("HElloWorld");
});
conn.on("text", function (str) {
    console.log("Received "+str)
    conn.sendText(str.toUpperCase()+"!!!")
})
conn.on("close", function (code, reason) {
    console.log("Connection closed")
})
conn.on('error',function(code){
    console.log(code);
})


setInterval(function(){
    conn.sendText("HelloWorld");
},3000);